package com.wyl.auth.config.security;

import cn.dev33.satoken.stp.StpInterface;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.util.StrUtil;
import com.wyl.auth.service.SysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Collections;
import java.util.List;

/**
 * @Description
 * @Author WuYiLong
 * @Date 2025/4/13 10:08
 */
@Component
public class StpInterfaceImpl implements StpInterface {

    @Autowired
    private SysMenuService sysMenuService;

    @Override
    public List<String> getPermissionList(Object loginId, String loginType) {
        String userId = StrUtil.toString(loginId);
        List<String> menuCodes = sysMenuService.getMenuCodesByUserId(Long.valueOf(userId));
        return menuCodes;
    }

    @Override
    public List<String> getRoleList(Object loginId, String loginType) {
        return Collections.emptyList();
    }
}